"""

编程实现：循环输入10个人的信息（姓名，年龄，性别，身高），
并存储到数据库中

"""
import pymysql

db = pymysql.connect(
    host='localhost',
    port=3306,
    database='person',
    user='root',
    password='123456',
    charset='utf8'

)

cursor = db.cursor()
for i in range(10):
    print(f"\n第{i + 1}个人")
    username = input("请输入姓名:")
    age = int(input("请输入年龄:"))
    sex = input("请输入性别:")
    high = float(input("请输入身高（米）:"))



    sql = "insert into person(username,age,sex,high) values (%s,%s,%s,%s)"

    cursor.execute(sql,(username,age,sex,high))

    db.commit()

cursor.close()

db.close()



# value = ("('赵一',20,'男',1.75),"
#          "('钱二',22,'男',1.82),"
#          "('孙三',18,'女',1.68),"
#          "('李四',26,'男',1.78),"
#          "('周五',22,'男',1.91),"
#          "('吴六',25,'女',1.62),"
#          "('郑七',22,'女',1.75),"
#          "('王八',20,'男',1.82),"
#          "('刘九',16,'男',1.85),"
#          "('薛十',17,'男',1.71)")